package recursion;

public class BallMatter {
    public static void main(String[] args) {
        Ball b = new Ball();
        b.ballMove(100,10);
        System.out.println(b.getCount());
    }

}

class Ball {
    int n;
    double h;
    double count;

    public void ballMove(double height, int num) {
        n = num;
        h = height;
        if (n == 0 || h == 0) {
            System.out.println(height);
            return;
        }
        count += h;
        h /= 2;
        n--;
        ballMove(h, n);
    }

    public double getCount() {
        return count;
    }
}
